package com.fdb.efp.nls.service.yed.common.rules.apply;

import com.fdb.basic.framework.core.constant.EsbRetCodeStandard;
import com.fdb.basic.framework.core.exception.BizException;
import com.fdb.efp.nls.common.constant.NlsApplyInfoEnums;
import com.fdb.efp.nls.service.yed.common.rules.CheckRule;
import com.fdb.efp.nls.service.vo.sx.NlsCreditInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 需求编号:2019D08--
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/12/4
 * 功能描述:
 * 修改日期:2019/12/4
 * 修改描述:
 */
public class CreditNotPassRule implements CheckRule {
    private Logger logger = LoggerFactory.getLogger(CreditNotPassRule.class);
    private NlsCreditInfoVO nlsCreditInfoVO;
    public CreditNotPassRule(NlsCreditInfoVO nlsCreditInfoVO) {
        this.nlsCreditInfoVO = nlsCreditInfoVO;
    }

    @Override
    public void check() throws BizException {
        if (!NlsApplyInfoEnums.NlsApplyState.PASS.getKey().equals(nlsCreditInfoVO.getApprvSts())) {
            if (logger.isErrorEnabled()) {
                logger.error("普税贷用信通知接口 用信申请流水号:【" + nlsCreditInfoVO.getLmtApplySeq() + "】 授信申请审批不是通过状态!");
            }
            throw new BizException(EsbRetCodeStandard.WFJKYWGZ.getValue(), "授信申请审批不是通过状态！");
        }
    }
}
